<?php

class JamLoader {
	protected static function load($filePath){
		if(file_exists($filePath))
			include($filePath);
		else
			JError::raiseError(500, 'File ' . $filePath . ' does not exist!');
	}

	public static function loadLib($libName, $path = JB_FE_JAM){
		$fileName = $libName . '.php';
		
		JamLoader::load($path . DS . $fileName);
	}

	public static function loadController($name){
		$fileName = strtolower($name) . '.php';
		JamLoader::load(JB_FE_CONTROLLERS . DS . $fileName);
	}

	public static function loadModel($name){
		$fileName = strtolower($name) . '.php';
		JamLoader::load(JB_FE_MODELS . DS . $fileName);
	}

	public static function loadView($name){
		$fileName = strtolower($name) . '.php';
		JamLoader::load(JB_FE_VIEWS . DS . $fileName);
	}
}

?>
